<?php
/*
 * This is to show inside folders....
 */
$foldmenu = true;

include '../../include/config.php';
$folder_path = 'http://' . $_SERVER['HTTP_HOST'] . '/salusbaby/storage/' . $_COOKIE['bid'] . '/folders/';
$content_path = $folder_path . $_GET['f'] . '/';
$allextensions = array('jpg', 'gif', 'jpeg', 'png', 'JPG', 'JPEG', 'PNG');
?>
<?php include '../head.php'; ?>
<title><?= $_GET['f'] ?> </title>
<head>
    <link rel="stylesheet" href="../../include/css/jquery.treeview.css" />	
    <script src="../../include/js/external/jquery.cookie.js" type="text/javascript"></script>
    <script src="../../include/js/jquery.treeview.js" type="text/javascript"></script>
    <link rel="stylesheet" href="../../include/css/prettyPhoto.css" type="text/css" media="screen" charset="utf-8" />
    <script src="../../include/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="../../include/js/demotree.js"></script>
    <style>
        .bb th, .bb td{
            border-bottom:  1px #000000 dotted !important ;
        }
    </style>
</head>
<body>
    <div id="wrapper" >

        <?php include '../header_profile.php'; ?>
        <?php include '../menu_left.php'; ?>
        <?php include 'folder_menu.php'; ?>


        <div id="mainContent" class="gallery clearfix">
            <hr>
            <?php if ($_GET['f'] != 'pregnancy') { ?>
                You are inside folder : <b><?= $_GET['f'] ?></b><br/>
                Password of this folder : <b>
                    <?php
                    $p = mysql_query("select pwd from baby_folders where sr='" . $_GET['sr'] . "' ") or die(mysql_error());
                    while ($row2 = mysql_fetch_array($p)) {
                        echo $pwd = $row2['pwd'];
                    }
                    ?>
                </b> &nbsp;&nbsp; <a href="#" id="dlg3">update</a>
                <hr>
                <i>Your Uploaded Files</i>
                <table style="width: 100%; text-align: center; " class="bb" >
                    <tr>
                        <th style="width: 40px;">Sr.</th>
                        <th style="width: 400px;">File Name</th>
                        <th style="width: 160px;">Operation</th>
                    </tr>
                    <?php
                    $files_list0 = mysql_query("select * from baby_upload_files where bid='" . $_COOKIE['bid'] . "' and mdir='" . $_GET['f'] . "' ") or die(mysql_error());
                    $i = 1;
                    while ($flists = mysql_fetch_array($files_list0)) {
                        ?>                                    
                        <tr class="bb">
                            <td><?= $i ?></td>
                            <td>
                                <?php
                                if ($flists['attr'] == '') {
                                    $filename = $flists['file_name'];
                                } else {
                                    $filename = $flists['attr'];
                                }
                                $ext = pathinfo($flists['file_name'], PATHINFO_EXTENSION);
                                if (in_array($ext, $allextensions)) {
                                    echo '<a href="' . $content_path . $flists['file_name'] . '" rel="prettyPhoto" >' . $filename . '</a>';
                                } else {
                                    echo '<a href="' . $content_path . $flists['file_name'] . '" >' . $filename . '</a>';
                                }
                                ?>
                            </td>
                            <td>
                        <center>
                            <ul id="icons" class="ui-widget ui-helper-clearfix">                                        
        <!--                            <li class="ui-state-default ui-corner-all" title="Edit"><a href="?p=edit&uid=<?= $flists['uid'] ?>&sur=<?= $flists['sr'] ?>"><span class="ui-icon ui-icon-gear"></a></span></li>-->
                                <li class="ui-state-default ui-corner-all" title="Delete"><a href="../folder/folder_delete.php?bid=<?= $flists['bid'] ?>&sur=<?= $flists['Sr'] ?>&dir=<?= $_GET['f'] ?>"><span class="ui-icon ui-icon-trash"></a></span></li>
                            </ul>
                        </center>
                        </td>
                        </tr>                
                        <?php
                        $i++;
                    }
                    ?>
                </table>                       
                <?php
            }
            if ($_GET['f'] == 'pregnancy') {
                ?>
                You are inside folder : <b><?= $_GET['f'] ?></b><br/>
                Password of this folder : <b>
                    <?php
                    $p = mysql_query("select pwd from baby_folders where sr='" . $_GET['sr'] . "' ") or die(mysql_error());
                    while ($row2 = mysql_fetch_array($p)) {
                        echo $pwd = $row2['pwd'];
                    }
                    ?>
                </b> &nbsp;&nbsp; <a href="#" id="dlg3">update</a>
                <hr>
                <i>Your Test Files of Pregnancy</i>
                <table border="0" style="width: 600px; text-align: center; " >
                    <tr class="bb">
                        <th style="width: 40px;">Sr.</th>
                        <th style="width: 500px;">Test Name</th>
                        <th style="width: 60px;">Operation</th>
                    </tr>
                    <?php
                    $test_list0 = mysql_query("select * from baby_mother_tests where bid='" . $_COOKIE['bid'] . "' ") or die(mysql_error());
                    $i = 1;
                    while ($row = mysql_fetch_array($test_list0)) {
                        $tid = $row['test_id'];
                        ?>
                        <td><?= $i ?></td>
                        <td>
                            <?php
                            $ext = pathinfo($row['file'], PATHINFO_EXTENSION);
                            $tst_nm = mysql_query("select * from baby_tests where test_id = $tid ") or die(mysql_error());
                            while ($row1 = mysql_fetch_array($tst_nm)) {
                                $test_name = $row1['test_name'];
                                if (in_array($ext, $allextensions)) {
                                    echo '<a href="' . $content_path . $row['file'] . '" rel="prettyPhoto" >' . $test_name . '(' . $row1['test_month'] . '&deg; month)' . '</a>';
                                } else {
                                    echo '<a href="' . $content_path . $row['file'] . '" >' . $test_name . '(' . $row1['test_month'] . '&deg; month)' . '</a>';
                                }
                            }
                            ?>
                        </td>
                        <td> 
                        <center>
                            <ul id="icons" class="ui-widget ui-helper-clearfix">                                        
        <!--                            <li class="ui-state-default ui-corner-all" title="Edit"><a href="?p=edit&uid=<?= $flists['uid'] ?>&sur=<?= $flists['sr'] ?>"><span class="ui-icon ui-icon-gear"></a></span></li>-->
                                <li class="ui-state-default ui-corner-all" title="Delete"><a href="../folder/folder_delete.php?bid=<?= $_COOKIE['bid'] ?>&sur=<?= $row['sr'] ?>&dir=<?= $_GET['f'] ?>"><span class="ui-icon ui-icon-trash"></a></span></li>
                            </ul>
                        </center>
                        </td>

                        </tr>

                        <?php
                        $i++;
                    }
                    ?>
                </table>
                <hr>
                <i>Your Other Files</i>
                <table border="0" style="width: 600px; text-align: center; " >
                    <tr class="bb">
                        <th style="width: 40px;">Sr.</th>
                        <th style="width: 500px;">Name</th>
                        <th style="width: 60px;">Operation</th>
                    </tr>
                    <?php
                    $list0 = mysql_query("select * from baby_upload_files where bid='" . $_COOKIE['bid'] . "' and mdir ='" . $_GET['f'] . "' ") or die(mysql_error());
                    $i = 1;
                    while ($row1 = mysql_fetch_array($list0)) {
                        ?>
                        <td><?= $i ?></td>
                        <td>
                             <?php
                                if ($row1['attr'] == '') {
                                    $filename = $row1['file_name'];
                                } else {
                                    $filename = $row1['attr'];
                                }
                                $ext = pathinfo($row1['file_name'], PATHINFO_EXTENSION);
                                if (in_array($ext, $allextensions)) {
                                    echo '<a href="' . $content_path . $row1['file_name'] . '" rel="prettyPhoto" >' . $filename . '</a>';
                                } else {
                                    echo '<a href="' . $content_path . $row1['file_name'] . '" >' . $filename . '</a>';
                                }
                                ?>
                        </td>
                        <td> 
                        <center>
                            <ul id="icons" class="ui-widget ui-helper-clearfix">                                        
        <!--                            <li class="ui-state-default ui-corner-all" title="Edit"><a href="?p=edit&uid=<?= $flists['uid'] ?>&sur=<?= $flists['sr'] ?>"><span class="ui-icon ui-icon-gear"></a></span></li>-->
                                <li class="ui-state-default ui-corner-all" title="Delete"><a href="../folder/folder_delete.php?bid=<?= $_COOKIE['bid'] ?>&sur=<?= $row1['Sr'] ?>&dir=<?= $_GET['f'] ?>&m=more"><span class="ui-icon ui-icon-trash"></a></span></li>
                            </ul>
                        </center>
                        </td>

                        </tr>

        <?php
        $i++;
    }
    ?>
                </table>


            <?php } ?>
        </div>

        <div id="dialog3" title="Chage Password of folder : <?= $_GET['f'] ?> ">
            <form action="pass_chage.php" method="post" >
                <input type="password" name="pwd" placeholder="New Password" /><br/>
                <input type="hidden" name="sr" value="<?= $_GET['sr'] ?>"  />
                <input type="hidden" name="rp" value="<?= $_GET['f'] ?>" />
                <input type="submit" value="Chage Password" />
            </form>
        </div>



    </div><!-- wrapper over    -->
    <script type="text/javascript" charset="utf-8">
        $(document).ready(function(){
            $("area[rel^='prettyPhoto']").prettyPhoto();
    				
            $(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'light_square',slideshow:3000, autoplay_slideshow: false});
            $(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'slow',slideshow:10000, hideflash: true});
    		
            $("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
                custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
                changepicturecallback: function(){ initialize(); }
            });

            $("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
                custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
                changepicturecallback: function(){ _bsap.exec(); }
            });
        });
    </script>
    <script src="../view/script.js"></script>
    <?php include '../menu_right.php'; ?>
</body>
</html>